package com.jerome.rmi.enums;

/**
 * Operation enumeration
 * @author jerome
 * @date 2023/7/28
 */
public enum OperatorEnum {
    MIN(1,"min"),
    MAX(2,"max"),
    LCM(3,"lcm"),
    GCD(4,"gcd"),
    ;
    private Integer code;
    private  String  name;

    OperatorEnum(Integer code, String desc) {
        this.code = code;
        this.name = desc;
    }

    public static OperatorEnum getByCode(Integer code){
        for (OperatorEnum value : OperatorEnum.values()) {
            if(value.code.equals(code)){
                return value;
            }
        }
        return null;
    }
    public static OperatorEnum getByName(String code){
        for (OperatorEnum value : OperatorEnum.values()) {
            if(value.name.equalsIgnoreCase(code)){
                return value;
            }
        }
        return null;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
